package com.sevenGroup.pawnshop.Utils;

import com.sevenGroup.pawnshop.exception.sevenGroupException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;

import java.util.List;

public class ParameterCalibrationUtil {

    public static void ParameterCalibration(BindingResult bindingResult) throws sevenGroupException {
        if(bindingResult.hasErrors()){
            List<ObjectError> allError = bindingResult.getAllErrors();
            for (ObjectError objectError : allError) {
                System.out.println(objectError.getDefaultMessage());
                throw new sevenGroupException(40025,"参数异常");
            }
        }
    }
}
